home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-02-01 | 2.4 KB | 71 lines | [TEXT/ToyS] |
- property inquiredTerm : ""
- set inquiredTerm to text returned of ¬
- (display dialog "Which term do you wish to search for?" default answer inquiredTerm)
- if inquiredTerm is "" then return
-
- -- get osax list
- try
- -- error -- If this won’t compile, comment out the line below this and uncomment this line
- set osaxFolder to path to scripting additions folder as string
- on error
- set osaxFolder to (path to extensions folder as string) & "Scripting Additions:"
- end try
- tell application "Finder" to ¬
- set osaxList to name of (every file whose file type is "osax") in folder osaxFolder
- if osaxList is {} then return
-
- set matchedOsaxen to []
- repeat with o in osaxList -- get aete suites from file
- set rf to null
- try
- set rf to res open file (osaxFolder & o) --without write permission
- set aeteSuites to res get rf id 0 type "aete"
- res close rf
- set rf to null
-
- set aeteSuites to item 5 of (cast aeteSuites without label)
- repeat with s in aeteSuites -- may be more than one suite
- set suiteName to s's first item
- -- get commands
- set suiteCommands to s's item 6
- repeat with c in suiteCommands
- set eventTerm to c's first item
- if eventTerm contains inquiredTerm then ¬
- set matchedOsaxen to matchedOsaxen & [{name:o as string, term:eventTerm}]
- end repeat
- end repeat
- on error --number -192 -- aete resource not found
- if rf ≠ null then res close rf
- end try
- end repeat
-
- -- release memory
- set [osaxList, aeteSuites, suiteName, suiteCommands, eventTerm] to [null, null, null, null, null]
-
- -- report matches
- if matchedOsaxen is {} then
- display dialog "No matches were found in the Scripting Additions folder." buttons "OK" default button 1 with icon stop
- return
- end if
-
- set reportName to "Matches found for ‘" & inquiredTerm & "’"
- set lastOsax to ""
- set dItems to []
- set y to 8
- repeat with o in matchedOsaxen
- if o's name ≠ lastOsax then
- set dItems to dItems & [{class:static text, bounds:[10, y, 150, y + 12], contents:o's name, font:2, justification:right}, ¬
- {class:static text, bounds:[155, y, 335, y + 12], contents:o's term}]
- set lastOsax to o's name
- set y to y + 16
- else
- set y to y + 12
- tell dItems's last item
- set contents to contents & return & o's term
- set bounds's item 4 to y
- end tell
- end if
- end repeat
- set dItems to dItems & [{class:push button, bounds:[280, 10, 330, 28], name:"OK"}]
-
- dd auto dialog {size:[340, y + 8], contents:dItems, style:movable dialog, name:reportName} with fonts [{name:"Geneva", size:9}, {style:bold}]